package com.springboot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by hboxs004 on 2018/3/9.
 */
@Controller
@RequestMapping(value = "/test")
public class TestController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @RequestMapping(value = "/index", method = {RequestMethod.GET, RequestMethod.POST})
    public String index() {
        logger.info("进入测试方法>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        System.out.println("======================= enter ========================");
        return "/index";
    }

    @RequestMapping(value = "/toBeRich/{name}", method = {RequestMethod.GET, RequestMethod.POST})
    public String toBeRich(@PathVariable(name = "name") String name, Model modelMap) {
        System.out.println("======================= toBeRich ========================");
        System.out.println(name);
        modelMap.addAttribute("dream", name);
        return "rich";
    }

    @RequestMapping(value = "/discount", method = {RequestMethod.GET, RequestMethod.POST})
    public String discount() {
        return "/discountTimer";
    }

}
